﻿#ifndef MAPPER_DEVICE_H
#define MAPPER_DEVICE_H

#include <qobject.h>
#include "ObjAutoInject.h"
#include <qvector.h>
#include <qsqlquery.h>
#include <qsqlerror.h>
#include <qlist.h>

class DataBaseConnector;
class Mapper_Device : public QObject, public ObjAutoInject
{
  Q_OBJECT
private://property
  const QString string_dataBaseName_user="user";
  const QString string_dataBaseName_device="device";
  const QString string_dataBaseName_map_user_device="map_user_device";
  const QString string_user_id="user_id";
  const QString string_user_name="user_name";
  const QString string_device_id="device_id";
private://dependency
  DataBaseConnector* dataBaseConnector=Q_NULLPTR;
public:
  explicit Mapper_Device();
  virtual ~Mapper_Device();
signals:
public:
  bool isVaildDevice(uint deviceId);
  QList<uint> getDevicesByUserName(QString userName);
  QList<uint> getDevicesByUserId(uint user_id);
public://geter and seter
  DataBaseConnector* getDataBaseConnector();
  void setDataBaseConnector(DataBaseConnector* dataBaseConnector);
public:
  virtual void objectAutoInjection(QHash<QString, QObject *> *objMap);
};

#endif // MAPPER_DEVICE_H
